﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Drawing;
using SLRT.business.src;

namespace SLRT.usercontrols
{
    /// <summary>
    /// Interaction logic for ResultControl.xaml
    /// </summary>
    public partial class ResultControl : UserControl
    {
        public ResultControl()
        {
            InitializeComponent();
            DataContext = CaptureModel.Instance;
        }

        public void SetCorrectString(String text)
        {
            this.CorrectString.Text = text;
        }

        public void SetCurrentLetter(String text)
        {
            this.CurrentLetter.Text = text;
        }

        public void ChangeImage(Bitmap newImage)
        {
            this.QueryImage.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(newImage.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty,
                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.QueryImage.Width = this.ActualWidth / 10;
            this.ProcessingRectangle.Width = this.ActualWidth / 3;
            this.ProcessingRectangle.Height = this.ActualHeight / 3;
            this.ProcessingRectangle.Margin = new Thickness(0, 0, this.ActualWidth / 10, 0);
        }
    }
}
